| Conditions | 5 | 
| Total Lines | 22 | 
| Code Lines | 12 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 11 | 
| CRAP Score | 5 | 
| Changes | 0 | ||
| 1 | class Sorter { | ||
| 11 |     compare(firstElement, secondElement) { | ||
| 12 | 22 | let nameA = firstElement[this.key]; | |
| 13 | 22 | let nameB = secondElement[this.key]; | |
| 14 | |||
| 15 | 22 |         if (typeof nameA === 'string') { | |
| 16 | 5 | nameA = nameA.toUpperCase(); | |
| 17 | } | ||
| 18 | |||
| 19 | 22 |         if (typeof nameB === 'string') { | |
| 20 | 5 | nameB = nameB.toUpperCase(); | |
| 21 | } | ||
| 22 | |||
| 23 | 22 |         if (nameA < nameB) { | |
| 24 | 8 | return -1 * this.moveDirection; | |
| 25 | } | ||
| 26 | |||
| 27 | 14 |         if (nameA > nameB) { | |
| 28 | 10 | return 1 * this.moveDirection; | |
| 29 | } | ||
| 30 | |||
| 31 | 4 | return 0; | |
| 32 | } | ||
| 33 | |||
| 44 |